package com.dynamixsoftware.printershare.smb.dcerpc.msrpc;

import com.dynamixsoftware.printershare.smb.dcerpc.DcerpcMessage;
import com.dynamixsoftware.printershare.smb.dcerpc.ndr.NdrBuffer;
import com.dynamixsoftware.printershare.smb.dcerpc.ndr.NdrException;
import com.dynamixsoftware.printershare.smb.dcerpc.ndr.NdrObject;
import java.io.UnsupportedEncodingException;

public class rprn
{
  public static String getSyntax()
  {
    return "12345678-1234-abcd-ef00-0123456789ab:1.0";
  }
  
  private static class PrinterInfo1Struct
    extends NdrObject
  {
    private String comment;
    private String description;
    private int flags;
    private String name;
    
    public PrinterInfo1Struct(Object object) {
		// TODO Auto-generated constructor stub
	}


	public void decode(NdrBuffer var1) throws NdrException {
        var1.align(4);
        this.flags = var1.dec_ndr_long();
        int var3 = var1.dec_ndr_long();
        int var4 = var1.dec_ndr_long();
        int var5 = var1.dec_ndr_long();
        int var6 = 0;
        int var7 = 16;

        do {
           if(var7 == var3) {
              int var13 = var1.index;

              while(var1.dec_ndr_short() != 0) {
                 ;
              }

              try {
                 this.description = new String(var1.buf, var13, -2 + (var1.index - var13), "UTF-16LE");
              } catch (UnsupportedEncodingException var15) {
                 var15.printStackTrace();
              }

              ++var6;
           }

           if(var7 == var4) {
              int var11 = var1.index;

              while(var1.dec_ndr_short() != 0) {
                 ;
              }

              try {
                 this.name = new String(var1.buf, var11, -2 + (var1.index - var11), "UTF-16LE");
              } catch (UnsupportedEncodingException var17) {
                 var17.printStackTrace();
              }

              ++var6;
           }

           if(var7 == var5) {
              int var9 = var1.index;

              while(var1.dec_ndr_short() != 0) {
                 ;
              }

              try {
                 this.comment = new String(var1.buf, var9, -2 + (var1.index - var9), "UTF-16LE");
              } catch (UnsupportedEncodingException var16) {
                 var16.printStackTrace();
              }

              ++var6;
           }

           var1.dec_ndr_small();
           ++var7;
        } while(var6 < 3);

     }

    
    public void encode(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      paramNdrBuffer.align(4);
      paramNdrBuffer.enc_ndr_long(this.flags);
      paramNdrBuffer.enc_ndr_referent(this.description, 1);
      paramNdrBuffer.enc_ndr_referent(this.name, 1);
      paramNdrBuffer.enc_ndr_referent(this.comment, 1);
      if (this.comment != null)
      {
        paramNdrBuffer = paramNdrBuffer.deferred;
        paramNdrBuffer.enc_ndr_string(this.comment);
      }
      if (this.name != null)
      {
        paramNdrBuffer = paramNdrBuffer.deferred;
        paramNdrBuffer.enc_ndr_string(this.name);
      }
      if (this.description != null) {
        paramNdrBuffer.deferred.enc_ndr_string(this.description);
      }
    }
  }
  
  private static class PrinterInfo2Struct
    extends NdrObject
  {
    private int Attributes;
    private int AveragePPM;
    private int DefaultPriority;
    private int Priority;
    private int StartTime;
    private int Status;
    private int UntilTime;
    private int cJobs;
    private String pComment;
    private String pDatatype;
    private int pDevMode;
    private String pDriverName;
    private String pLocation;
    private String pParameters;
    private String pPortName;
    private String pPrintProcessor;
    private String pPrinterName;
    private byte[] pSecurityDescriptor;
    private String pSepFile;
    private String pServerName;
    private String pShareName;
    
    public PrinterInfo2Struct(Object object) {
		// TODO Auto-generated constructor stub
	}

	public void decode(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      paramNdrBuffer.align(4);
      int i = paramNdrBuffer.dec_ndr_long();
      int j = 0;
      if (i == 0) {
        j = 0 + 1;
      }
      int k = paramNdrBuffer.dec_ndr_long();
      if (k == 0) {
        j++;
      }
      int m = paramNdrBuffer.dec_ndr_long();
      if (m == 0) {
        j++;
      }
      int n = paramNdrBuffer.dec_ndr_long();
      if (n == 0) {
        j++;
      }
      int i1 = paramNdrBuffer.dec_ndr_long();
      if (i1 == 0) {
        j++;
      }
      int i2 = paramNdrBuffer.dec_ndr_long();
      if (i2 == 0) {
        j++;
      }
      int i3 = paramNdrBuffer.dec_ndr_long();
      if (i3 == 0) {
        j++;
      }
      this.pDevMode = paramNdrBuffer.dec_ndr_long();
      paramNdrBuffer.dec_ndr_long();
      paramNdrBuffer.dec_ndr_long();
      paramNdrBuffer.dec_ndr_long();
      paramNdrBuffer.dec_ndr_long();
      paramNdrBuffer.dec_ndr_long();
      this.Attributes = paramNdrBuffer.dec_ndr_long();
      this.Priority = paramNdrBuffer.dec_ndr_long();
      this.DefaultPriority = paramNdrBuffer.dec_ndr_long();
      this.StartTime = paramNdrBuffer.dec_ndr_long();
      this.UntilTime = paramNdrBuffer.dec_ndr_long();
      this.Status = paramNdrBuffer.dec_ndr_long();
      this.cJobs = paramNdrBuffer.dec_ndr_long();
      this.AveragePPM = paramNdrBuffer.dec_ndr_long();
      int i4 = 84;
      for (;;)
      {
        int i5 = j;
        if (i4 == i) {}
        try
        {
          int i12 = paramNdrBuffer.index;
          while (paramNdrBuffer.dec_ndr_short() != 0) {}
          this.pServerName = new String(paramNdrBuffer.buf, i12, -2 + (paramNdrBuffer.index - i12), "UTF-16LE");
          i4 += paramNdrBuffer.index - i12;
          j++;
          if (i4 == k)
          {
            int i6 = paramNdrBuffer.index;
            while (paramNdrBuffer.dec_ndr_short() != 0) {}
            this.pPrinterName = new String(paramNdrBuffer.buf, i6, -2 + (paramNdrBuffer.index - i6), "UTF-16LE");
            i4 += paramNdrBuffer.index - i6;
            j++;
          }
          if (i4 == m)
          {
            int i7 = paramNdrBuffer.index;
            while (paramNdrBuffer.dec_ndr_short() != 0) {}
            this.pShareName = new String(paramNdrBuffer.buf, i7, -2 + (paramNdrBuffer.index - i7), "UTF-16LE");
            i4 += paramNdrBuffer.index - i7;
            j++;
          }
          if (i4 == n)
          {
            int i8 = paramNdrBuffer.index;
            while (paramNdrBuffer.dec_ndr_short() != 0) {}
            this.pPortName = new String(paramNdrBuffer.buf, i8, -2 + (paramNdrBuffer.index - i8), "UTF-16LE");
            i4 += paramNdrBuffer.index - i8;
            j++;
          }
          if (i4 == i1)
          {
            int i9 = paramNdrBuffer.index;
            while (paramNdrBuffer.dec_ndr_short() != 0) {}
            this.pDriverName = new String(paramNdrBuffer.buf, i9, -2 + (paramNdrBuffer.index - i9), "UTF-16LE");
            i4 += paramNdrBuffer.index - i9;
            j++;
          }
          if (i4 == i2)
          {
            int i10 = paramNdrBuffer.index;
            while (paramNdrBuffer.dec_ndr_short() != 0) {}
            this.pComment = new String(paramNdrBuffer.buf, i10, -2 + (paramNdrBuffer.index - i10), "UTF-16LE");
            i4 += paramNdrBuffer.index - i10;
            j++;
          }
          if (i4 == i3)
          {
            int i11 = paramNdrBuffer.index;
            while (paramNdrBuffer.dec_ndr_short() != 0) {}
            this.pLocation = new String(paramNdrBuffer.buf, i11, -2 + (paramNdrBuffer.index - i11), "UTF-16LE");
            i4 += paramNdrBuffer.index - i11;
            j++;
          }
          if (i5 == j)
          {
            paramNdrBuffer.dec_ndr_small();
            i4++;
          }
          if (j >= 7) {}
        }
        catch (UnsupportedEncodingException localUnsupportedEncodingException)
        {
          localUnsupportedEncodingException.printStackTrace();
        }
      }
    }
    
    public void encode(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      paramNdrBuffer.align(4);
      paramNdrBuffer.enc_ndr_referent(this.pServerName, 1);
      paramNdrBuffer.enc_ndr_referent(this.pPrinterName, 1);
      paramNdrBuffer.enc_ndr_referent(this.pShareName, 1);
      paramNdrBuffer.enc_ndr_referent(this.pPortName, 1);
      paramNdrBuffer.enc_ndr_referent(this.pDriverName, 1);
      paramNdrBuffer.enc_ndr_referent(this.pComment, 1);
      paramNdrBuffer.enc_ndr_referent(this.pLocation, 1);
      paramNdrBuffer.enc_ndr_long(this.pDevMode);
      paramNdrBuffer.enc_ndr_referent(this.pSepFile, 1);
      paramNdrBuffer.enc_ndr_referent(this.pPrintProcessor, 1);
      paramNdrBuffer.enc_ndr_referent(this.pDatatype, 1);
      paramNdrBuffer.enc_ndr_referent(this.pParameters, 1);
      paramNdrBuffer.enc_ndr_referent(this.pSecurityDescriptor, 1);
      paramNdrBuffer.enc_ndr_long(this.Attributes);
      paramNdrBuffer.enc_ndr_long(this.Priority);
      paramNdrBuffer.enc_ndr_long(this.DefaultPriority);
      paramNdrBuffer.enc_ndr_long(this.StartTime);
      paramNdrBuffer.enc_ndr_long(this.UntilTime);
      paramNdrBuffer.enc_ndr_long(this.Status);
      paramNdrBuffer.enc_ndr_long(this.cJobs);
      paramNdrBuffer.enc_ndr_long(this.AveragePPM);
    }
  }
  
  static class RpcClosePrinter
    extends DcerpcMessage
  {
    private byte[] printerhandle;
    public int retval;
    
    RpcClosePrinter(byte[] paramArrayOfByte)
    {
      this.printerhandle = paramArrayOfByte;
    }
    
    public void decode_out(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      int i = -4 + this.alloc_hint;
      paramNdrBuffer.readOctetArray(new byte[i], 0, i);
      this.retval = paramNdrBuffer.dec_ndr_long();
    }
    
    public void encode_in(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      for (int i = 0; i < this.printerhandle.length; i++) {
        paramNdrBuffer.enc_ndr_small(this.printerhandle[i]);
      }
    }
    
    public int getOpnum()
    {
      return 29;
    }
  }
  
  static class RpcGetPrinter
    extends DcerpcMessage
  {
    private int cbBuf;
    protected String driverName;
    private NdrObject info;
    private int level;
    String location;
    public int pcbneeded;
    protected String printerName;
    private byte[] printerhandle;
    public int retval;
    protected String serverName;
    
    RpcGetPrinter(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    {
      this.printerhandle = paramArrayOfByte;
      this.level = paramInt1;
      this.cbBuf = paramInt2;
      if (paramInt2 == 0)
      {
        this.info = null;
        return;
      } else {
    	  switch (paramInt1)
          {
          default: 
          case 1: 
            this.info = new rprn.PrinterInfo1Struct(null);
            return;
          case 2:
        	this.info = new rprn.PrinterInfo2Struct(null);
        	return;
          }
      }
     
    }
    
  
    
    public void decode_out(NdrBuffer var1) throws NdrException {
        if(var1.dec_ndr_long() != 0) {
           var1.dec_ndr_long();
           if(this.info != null) {
              var1 = var1.deferred;
              this.info.decode(var1);
              if(this.level == 2) {
                 this.driverName = ((rprn.PrinterInfo2Struct)this.info).pDriverName;
                 this.printerName = ((rprn.PrinterInfo2Struct)this.info).pPrinterName;
                 this.serverName = ((rprn.PrinterInfo2Struct)this.info).pServerName;
                 this.location = ((rprn.PrinterInfo2Struct)this.info).pLocation;
              } else {
                 this.driverName = "";
                 this.printerName = "";
                 this.serverName = "";
                 this.location = "";
              }
           }
        }

        this.pcbneeded = var1.dec_ndr_long();
        this.retval = var1.dec_ndr_long();
     }
    
    
    public void encode_in(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      for (int i = 0; i < this.printerhandle.length; i++) {
        paramNdrBuffer.enc_ndr_small(this.printerhandle[i]);
      }
      paramNdrBuffer.enc_ndr_long(this.level);
      paramNdrBuffer.enc_ndr_referent(this.info, 1);
      if (this.info != null)
      {
        paramNdrBuffer.enc_ndr_long(this.cbBuf);
        paramNdrBuffer.writeOctetArray(new byte[this.cbBuf], 0, this.cbBuf);
      }
      paramNdrBuffer.enc_ndr_long(this.cbBuf);
    }
    
    public int getOpnum()
    {
      return 8;
    }
  }
  
  static class RpcOpenPrinter
    extends DcerpcMessage
  {
    private String PrinterName;
    protected byte[] printerhandle;
    public int retval;
    
    RpcOpenPrinter(String paramString)
    {
      this.PrinterName = paramString;
    }
    
    public void decode_out(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      int i = -4 + this.alloc_hint;
      this.printerhandle = new byte[i];
      paramNdrBuffer.readOctetArray(this.printerhandle, 0, i);
      this.retval = paramNdrBuffer.dec_ndr_long();
    }
    
    public void encode_in(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      paramNdrBuffer.enc_ndr_referent(this.PrinterName, 1);
      if (this.PrinterName != null) {
        paramNdrBuffer.enc_ndr_string(this.PrinterName);
      }
      paramNdrBuffer.enc_ndr_referent(this.PrinterName, 1);
      paramNdrBuffer.enc_ndr_string("RAW");
      paramNdrBuffer.enc_ndr_long(0);
      paramNdrBuffer.enc_ndr_long(0);
      paramNdrBuffer.enc_ndr_long(8);
    }
    
    public int getOpnum()
    {
      return 1;
    }
  }
  
  static class RpcStartDocPrinter
    extends DcerpcMessage
  {
    public int job_id;
    private String job_name;
    private byte[] printerhandle;
    public int retval;
    
    RpcStartDocPrinter(byte[] paramArrayOfByte, String paramString)
    {
      this.printerhandle = paramArrayOfByte;
      this.job_name = paramString;
    }
    
    public void decode_out(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      this.job_id = paramNdrBuffer.dec_ndr_long();
      this.retval = paramNdrBuffer.dec_ndr_long();
    }
    
    public void encode_in(NdrBuffer paramNdrBuffer)
      throws NdrException
    {
      for (int i = 0; i < this.printerhandle.length; i++) {
        paramNdrBuffer.enc_ndr_small(this.printerhandle[i]);
      }
      paramNdrBuffer.enc_ndr_long(1);
      paramNdrBuffer.enc_ndr_referent(this.job_name, 1);
      paramNdrBuffer.enc_ndr_string(this.job_name);
      paramNdrBuffer.enc_ndr_referent(null, 1);
      paramNdrBuffer.enc_ndr_referent(null, 1);
    }
    
    public int getOpnum()
    {
      return 17;
    }
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.smb.dcerpc.msrpc.rprn
 * JD-Core Version:    0.7.0.1
 */